﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Xml;
using Microsoft.Kinect;
using Microsoft.Samples.Kinect.KinectExplorer;
using Microsoft.Samples.Kinect.WpfViewers;

namespace ZeroTouchUI
{
    public delegate void SavedEventHandler(object sender, EventArgs e);
    public class GestureRecorder : Window
    {
        private readonly GR2 gr2;
        private KinectSensor kinect;
        public MainWindow mainWindow;

        public List<Point> rightGesture;
        public List<Point> leftGesture;

        public event SavedEventHandler Saved;
        public virtual void OnSaved(EventArgs e)
        {
            if (Saved != null)
                Saved(this, e);
        }

        public GestureRecorder()
        {
            this.gr2 = new GR2();
            Content = this.gr2;
            Width = 715;
            Height = 600;
            Title = "Gesture Recorder";
            this.Closed += new EventHandler(GestureRecorder_Closed);
        }

        public GestureRecorder(MainWindow mW)
        {
            mainWindow = mW;
            this.gr2 = new GR2(this.mainWindow);
            Content = this.gr2;
            Width = 715;
            Height = 600;
            Title = "Gesture Recorder";
            this.Closed += new EventHandler(GestureRecorder_Closed);
        }

        public KinectSensor Kinect
        {
            get
            {
                return this.kinect;
            }

            set
            {
                this.kinect = value;
                this.gr2.Kinect = this.kinect;
            }
        }

        private void GestureRecorder_Closed(object sender, EventArgs e)
        {
            this.Kinect = null;
        }
    }
}
